﻿#include <iostream>
using namespace std;

/* 操作符 */
class Operator
{
public:
	virtual double operator()(double a, double b)const = 0;
};
/* 加法 */
class Plus :public Operator
{
	double operator()(double a, double b)const 
	{
		return a + b;
	}
};
/* 减法 */
class Subtract :public Operator
{
	double operator()(double a, double b)const 
	{
		return a - b;
	}
};
/* 乘法 */
class Multiply :public Operator
{
	double operator()(double a, double b)const 
	{
		return a * b;
	}
};
/* 除法 */
class Divide :public Operator
{
	double operator()(double a, double b)const throw(range_error)
	{
		if (b == 0)throw range_error("除数不能为0！");
		return a / b;
	}
};
/* 运算符工厂 */
class OperatorFactory
{
public:
	static Operator* getOperator(string op) throw (bad_typeid)
	{
		if (op == "+")return new Plus;
		else if (op == "-")return new Subtract;
		else if (op == "*")return new Multiply;
		else if (op == "/")return new Divide;
		throw bad_typeid();
	}
};

int main()
{
	while (true) {
		Operator* opt;
		double a, b;
		string op;
		cin >> a >> op >> b;
		try
		{
			opt = OperatorFactory::getOperator(op);
		}
		catch (bad_typeid)
		{
			cout << "运算符不存在" << endl;
			continue;
		}

		try {
			cout << (*opt)(a, b) << endl;
		}
		catch (range_error err)
		{// 参与运算的值不合法
			cout << "运算错误！ " << err.what() << endl;
			delete opt;
			continue;
		}
		delete opt;
	}
	return 0;
}
